home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / hir / hir5 Folder.sit / hir5 Folder / HIR5-2.TXT < prev    next >
Text File  |  1998-04-23  |  24KB  |  648 lines

  1. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\.
  2. \                               Ax-Talk                                      /
  3. /                  A UNIX Shell script chat program                          \
  4. \                                                                            /
  5. /                               by: Axon                                     \
  6. .\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/.
  7.  
  8. It's always been said that nessecity is the mother of invention.
  9. Since hackers always seem to come up with crazy little programs, toys, tools,
  10. and other stuff like that, you'd think they often find themselves in a
  11. position of nessecity.  I am no different.  When I need something, and need
  12. it fast, I make it myself.  As I sit here, I'm once again going to type a
  13. whole article on my palmtop, because my laptop is (again) down, but this time
  14. I'm prepared.
  15.  
  16. My favorite computer bit the dust for the 5th time just a few weeks ago,
  17. and I'm sure that I'll once again resurrect it, it's just a matter of when.
  18. (for those of you that care, the processor isn't getting any juice.  It's
  19. not like I FDISK'd my hard drive.)  Since I am in the process of loading up
  20. my palmtop with toys so that it can almost take the place of my laptop, I
  21. found that one major problem exists: the lack of a good terminal program
  22. with TRUE VT-100 emulation, file transfer, and other things.  Well I finally
  23. got a program with Xmodem (barf).  Nothing with a good vt-100 though.  The 
  24. only thing I really need vt100 for is  talk  in unix.  it screws up my 
  25. palmtop screen even when the built-in term program "supports" vt emulation.
  26. On top of that, unix talk only allows 2 people to chat head to head, and 
  27. sometimes I want to talk to more people than that at once.  Sounds like a 
  28. combo between nessecity, boredom, and desire.  A very stimulating mixture of 
  29. situations for a hacker.  Enter: Ax-Talk.
  30.  
  31. In 2 days, Ax-Talk went from a 5-minute "read and regurgitate to these 
  32. terminals" shell script to an advanced, menu-ized, fairly powerful program
  33. (for a shell script at least).  In its first stages, you had to type the 
  34. full path to your chat-buddy's terminal (/dev/pts/xxx, or similar), and
  35. there wasn't even an exit command.  You just ^C to get out.  That's not
  36. very efficient.  There were eventually 5 slots, so you can talk to 5 other 
  37. people at once, and if you ended up not using all 5 slots, you wound up
  38. having to type "/dev/null" in each of them you didn't use.  Let's face it,
  39. it sucked.
  40.  
  41. The first things I really noticed that I hated in it was having to look up
  42. the terminal that you would want to send messages to, and associating that
  43. with a user.  Along with that, having to type /dev/null 3 times...
  44. Also, Originally, you couldn't add or cut off any connections without
  45. quitting and restarting. yuck.
  46.  
  47. I fixed the "quitting and restarting" mess first.  You could eventually
  48. add or cut connections (still using /dev/...) while in the program.
  49. Then I found out that I could write a huge long line of code that could
  50. parse out a username and come up with what terminal they were on, and put
  51. the terminal path into a vaiable.  This was a giant step.  The /dev/null
  52. thing was easy to get rid of after all that.  My baby was growing from 11
  53. lines to 175 or more.
  54.  
  55. Commands.  I must have commands.  I added some cool commands to it.  The
  56. first, which proves to be most useful, is the .quit command.  It's nice to
  57. be able to quit without having to break out of it.  I then made a .clear
  58. command, to clear the screen.  Clearing the screen is important, after all.
  59. I threw in a .action (chat actions), .exec (run a command from within ax-
  60. talk), and .help to show novices all the commands.  This was in addition
  61. to the first command, .users, which allows you to change who gets your 
  62. messages.
  63.  
  64. It's now quite bulky, but it works.  Thanks to arrays, I was able to shrink
  65. it down even more.  In the earlier revisions, I was repeating a lot of 
  66. code.
  67.  
  68. I eventually brought back the option of using the terminal path, because
  69. Ax-Talk didn't like it when a person was logged on more than once.  I
  70. eventually fixed that problem, too.  If a person is logged on more than
  71. once, it informs you of this condition, then asks which terminal to use.
  72. I figured I would throw a copy of my script in here (since that was kind
  73. of the whole point of the article anyways).  I'll warn you that the script
  74. does NOT conform to HiR article format rules.  Several lines in it had to
  75. go over 78 characters, so don't miss them!
  76.  
  77. Ax-Talk has become very large for being a simple shell script, but at the 
  78. same time, it's also had the chance to be refined and is now extremely
  79. powerful, if you consider that it's nothing more than a bunch of UNIX
  80. shell commands strung together end-to-end.  Woven into its rather complex
  81. web of commands lies the ability to modify it.  It even has a config file.
  82.  
  83. Note: I have yet to get this to work in linux.  I only have AIX and linux
  84. to play with.  Works good on AIX.  If you can modify it to run under bash
  85. on your linux, send me the code at h_i_r@hotmail.com
  86.  
  87. if you don't mess with unix or the korn shell (or still don't want to read
  88. the code), At least read the Revision history at the beginning.
  89.  
  90.  
  91. <---------------------------CUT HERE--------------------------------->
  92. #!/bin/ksh
  93.  
  94. # Ax-Talk
  95. # Version 3.0
  96. #
  97. # Written by Axon <Axon@compfind.com>
  98. #
  99. # Ax-Talk History Timeline
  100. #
  101. # .01                   First edition.  Simply piped input to other terminal.
  102. #
  103. # .1                    Added support to pipe input to 5 other terminals.
  104. #
  105. # 1.0                   User-definable terminals; List of who is accepting
  106. #                       messages.
  107. #
  108. # 2.0                   Major changes.  All-day coding resulted in an inter-
  109. #                       active shell script that allowed the user to use the
  110. #                       name of the person instead of their terminal path.
  111. #                       added .users, .exec, .action, .help, and .quit
  112. #                       commands
  113. #
  114. # 2.1                   Added support for most any unix platform by using an
  115. #                       rc file.  Added comminication between actual ax-talk
  116. #                       clients so that if a user quit ax-talk, the script
  117. #                       will automatically remove them from the other
  118. #                       chatters' conference list.
  119. #
  120. # 2.2                   Added support for original terminal path.  Still
  121. #                       unable to fix the bug with multiple instances of
  122. #                       a username.  The multiple instance username problem
  123. #                       won't show its ugly face if the users are
  124. #                       careful and type the terminal path instead of their
  125. #                       username.  I'll work on trying to sense multiple
  126. #                       instances so that the script can warn the user, then
  127. #                       ask which terminal path to use.  Maybe in a later rev.
  128. #                       In order to use multiple unix setups, I had to make a
  129. #                       second shell script for configuration purposes.
  130. #                       Configuration options are held under each user's home
  131. #                       directory in .ax-talk.rc.  Communication between Ax-
  132. #                       Talk programs takes place by a world readable file
  133. #                       called .ax-talk-status under each user's home dir...
  134. #
  135. # 2.3                   Made the script manually check for the configuration
  136. #                       file.  I scrubbed the configuration script, and put
  137. #                       the code in the main script so it will run automatic-
  138. #                       ally if the config file is not found.
  139. #
  140. # 2.31                  Added --config command line switch to change config
  141. #                       info.  Not extremely useful yet, but maybe when there
  142. #                       is more meat to the config.
  143. #
  144. # 2.311                 Just a test phase.  took out tons of code and made
  145. #                       attempts to use arrays to save code space.  This may
  146. #                       eventually mean a nearly infinite amount of people
  147. #                       can chat on the same system.  (up to 1025?)
  148. #
  149. # 2.4                   Full array architecture.  Now you can define how many
  150. #                       users, not just limited to 5.  This is changed with
  151. #                       the --config command line switch.   Note, Ax-Talk 2.4
  152. #                       is no longer compatable with 2.311 and earlier, due to
  153. #                       an added field in .ax-talk.rc.
  154. #
  155. # 2.5                   Additional feature.  When entering usernames, if a
  156. #                       period (.) is entered, the script automatically fills
  157. #                       in the rest of the user slots with ".".  This will
  158. #                       dramatically speed up the time to enter Ax-Talk.
  159. #                       Tons of bugs to work out.  The array structure makes
  160. #                       this feature queasy.
  161. #
  162. # 2.8                   I'm practically ready to let this thing out to the
  163. #                       public, which I'm planning on doing with version 3.
  164. #                       This is kind of a "bug run", because i've fixed most
  165. #                       of the annoying things that I've seen.  I also 
  166. #                       added the ability to look at the source. I'm really 
  167. #                       happy with it right now, but there still could be a
  168. #                       plethora of releases between 2.8 and 3.0 if I have
  169. #                       any last-minute feature additions to toss in.
  170. #
  171. # 2.81                  A new command, .adduser was created.  This allows
  172. #                       people who set a ridiculously low number of maximum
  173. #                       chatters to redeem themselves.  It temporarily ups
  174. #                       the number of max chatters (for the current session
  175. #                       only), and asks for a username or terminal path.
  176. #
  177. # 3.0                   Finally added the great stuff.  Senses if the user
  178. #                       is logged in more than once.  Flawless.
  179.  
  180. #######################[RELEASE NOTES]##########################
  181. # Some unixes do not like \n in the echo lines.  This is       #
  182. # true in slackware linux, and possibly many others.  it's     #
  183. # not the case in most of the unixes i've tested this on,      #
  184. # but it can be easily fixed by changing any echo lines that   #
  185. # contain a \n to  echo -n.  If that doesn't work, i guess     #
  186. # you could remove all the \n things out of all the echo lines #
  187. # that contain them.  Substitute with echo ""                  # 
  188. #                                                              #
  189. # This script uses the cut command quite often.  On some       #
  190. # REALLY archaic BSD-derived unixes, this does not exist.      #
  191. # Honestly, they could be replaced with AWK, but awk commands  #
  192. # would take up even more space.  Feel free to convert to awk. #
  193. #                                                              #
  194. # This script has been tested to run on ksh, bash. sh (bsh)    #
  195. # all ya gotta do is change the first line of the script that  #
  196. # has #! /bin/sh to #! /bin/<whatever>.                        #
  197. ################################################################
  198.  
  199. #
  200. # Variables used in Ax-Talk
  201. #
  202. # $config     determines whether or not the config runs.  1 = active.
  203. # $start    config: starting byte of the terminal field.
  204. # $nding    config: Ending byte of the terminal field.
  205. # $maxterm    Maximum desired terminals, plus 1.  Used for loops.
  206. # $maxtrm    A "show" variable.  Depicts actual number of maximum terms.
  207. # $termstart    Starting byte of terminal field (Read from rc file.)
  208. # $termend      Ending byte of terminal field   (Read from rc file.)
  209. # $q        Counter variable for loops/arrays.
  210. # $comand    What the user types onto the chat line.
  211. # $actioncmd    What the user types into the action line.
  212. # $shellcommand    Read and executed with the .exec command.
  213. # $LOGNAME    Unix standard environment variable that holds the username.
  214. # $blarf    Temporary variable.  Used for <ENTER> pauses.
  215. # $uzer        Temporary Variable.  Plays a role in determining length
  216. #               of a cell in Array $User[x]
  217. #
  218. # Arrays used in Ax-Talk
  219. #
  220. # $user[x]    Usernames of selected people to chat with.
  221. # $termpath[x]    Terminal paths corresponding with usernames.
  222. #
  223.  
  224.  
  225.  
  226.  
  227.  
  228. #
  229. # Check for nessecary files.  If missing, run the install process.
  230. #
  231.  
  232. if [[ ! -a ~/.ax-talk.rc ]]
  233. then
  234. config=1
  235. fi
  236.  
  237. if [ $1 = "--config" ]
  238. then
  239. config=1
  240. fi
  241.  
  242. if [ $config = 1 ]
  243. then
  244.  
  245. start=13 #  
  246. nding=18 # Defaults.  These work on AIX 4.2
  247. maxtrm=5 # 
  248.  
  249. clear
  250. echo "Welcome to Ax-Talk, an interactive shell-script-based unix chat program!"
  251. echo "It looks like you haven't fully installed Ax-Talk yet, or you" 
  252. echo "have decided to change your ax-talk configuration."
  253. echo ""
  254. echo "If this is the first time you've run Ax-Talk, you should choose #1"
  255. echo ""
  256. echo "1) Configure both terminal fields and maximum # of chatters (recommended)." echo "2) Configure terminal fields."
  257. echo "3) Configure maximum # of chatters."
  258. read confchoice
  259. case $confchoice in
  260.  
  261. 1 )
  262. echo ""
  263. echo "Look for where the third field is on the chart below.  The field should"
  264. echo "read something like 'pts/4' or 'tty1'.  You will be asked where this"
  265. echo "field starts and ends.  We recommend adding 1 to the end of the field"
  266. echo "for instance if the field ended on number 19, type 20.  it won't hurt."
  267. echo "the numbers for each column are read from top to bottom.  look closely"
  268. echo "at the ledger above the list of people on the system."
  269. echo ""
  270. echo "         111111111122222222223333333333"
  271. echo "123456789012345678901234567890123456789"
  272. who -w
  273. echo "Terminal field start:"
  274. read start
  275. echo "Terminal Field end:"
  276. read nding
  277. echo
  278. echo "Maximum number of chatters at once: Recommend 5"
  279. read maxtrm
  280. maxterm=$(( 1 + $maxtrm ))
  281. echo "$start:$nding:$maxterm" > ~/.ax-talk.rc
  282. echo "0" > ~/.ax-talk-status
  283. echo "Ax-Talk Has been configured"
  284. echo "Press <ENTER> to start Ax-Talk!" ;;
  285.  
  286. 2)
  287. echo ""
  288. echo "Look for where the third field is on the chart below.  The field should"
  289. echo "read something like 'pts/4' or 'tty1'.  You will be asked where this"
  290. echo "field starts and ends.  We recommend adding 1 to the end of the field"
  291. echo "for instance if the field ended on number 19, type 20.  it won't hurt."
  292. echo "the numbers for each column are read from top to bottom.  look closely"
  293. echo "at the ledger above the list of people on the system."
  294. echo ""
  295. echo "         111111111122222222223333333333"
  296. echo "123456789012345678901234567890123456789"
  297. who -w
  298. echo "Terminal field start:"
  299. read start
  300. echo "Terminal Field end:"
  301. read nding
  302. echo ;;
  303.  
  304. 3)
  305. echo "Maximum number of chatters at once: Recommend 5"
  306. read maxtrm
  307. maxterm=$(( 1 + $maxtrm ))
  308. echo "$start:$nding:$maxterm" > ~/.ax-talk.rc
  309. echo "0" > ~/.ax-talk-status ;;
  310. esac
  311.  
  312. fi
  313. #
  314. # Initialize
  315. #
  316.  
  317. echo "1" > ~/.ax-talk-status  #tells the other Ax-Talks that we're alive.
  318. chmod 655 ~/.ax-talk-status   #make sure other Ax-Talks can read the file.
  319. termstart=$(cat ~/.ax-talk.rc | cut -f1 -d':') #\
  320. termend=$(cat ~/.ax-talk.rc | cut -f2 -d':')   # > Reads the 3 fields out
  321. maxterm=$(cat ~/.ax-talk.rc | cut -f3 -d':')   #/  of the config file.
  322. maxtrm=$(( maxterm-1 ))
  323. maxtermlen=$(( 7 ))
  324. #
  325. # Introduction and get usernames
  326. #
  327.  
  328. clear
  329. echo "Welcome To Ax-Talk, a Shell Script Based Chat Program"
  330. echo "Version 3.0 -- By Axon   Axon@compfind.com"
  331. echo ""
  332. echo "Please take time to look at the comments in the source code."
  333. echo ""
  334. echo "Enter $maxtrm usernames of the users you wish to chat with"
  335. echo "and hit enter after each name.  If you don't need all"
  336. echo "$maxtrm, enter a period (.)" 
  337. echo "If the person you wish to talk with is logged on more than once,"
  338. echo "you will be asked what terminal you wish to talk with.  If you"
  339. echo "would rather use the terminal path rather than the username, type a"
  340. echo "colon (:) followed by their terminal path (which is shown in the"
  341. echo "list below.)"  echo "Examples:"
  342. echo ":pts/5"
  343. echo ":ttyp3"
  344. echo ":ttyS1"
  345. echo ":tty8"
  346. echo ""
  347. echo "Users Who Are Accepting Messages:"
  348. who -w | grep "+"
  349. echo ""
  350.  
  351. #
  352. # Get usernames or terminal paths.  Convert usernames<-->Terminal Paths
  353. #
  354. q=$(( 1 ))
  355. while [ $q != $maxterm ]
  356. do
  357. echo "User $q"
  358. read user[$q] 
  359. termpath[$q]="$(who -w | grep "+" | grep ${user[$q]} | cut -b$termstart-$termend | cut -f1 -d' ')" 
  360. if [ $(echo ${user[$q]} | cut -b1) = ":" ] 
  361. then
  362. termpath[$q]="$(echo ${user[$q]} | cut -b2-)"
  363. user[$q]="$(who -w | grep "+" | grep ${termpath[$q]} | cut -b-8 | cut -f1 -d' ')"
  364. fi
  365. uzer=${user[$q]}
  366. if [ ${#uzer} = 1 ]
  367. then
  368. while [ $q != $maxterm ]
  369. do
  370. user[$q]="."
  371. termpath[$q]="null"
  372. q=$(( 1+$q ))
  373. done
  374. q=$(( $maxtrm ))
  375. fi 
  376. trmpath=${termpath[$q]}
  377. termlen=$(( ${#trmpath} ))
  378. #
  379. # Added in Ver 3.0.  Code to sense if a person is logged on more than once.
  380. #
  381.  
  382. if [ $termlen -gt $maxtermlen ]
  383. then
  384. echo "The user you have selected may be logged into the server"
  385. echo "more than once.  Please select a terminal from the following"
  386. echo "list.  Type the name of the terminal.  (I.E. pts/5   ttyp1  etc)."
  387. echo
  388. who -w | grep "+" | grep ${user[$q]}
  389. echo ""
  390. echo "Terminal Path:"
  391. read termpath[$q]
  392. #
  393. # Code to make sure that the terminal they chose is associated with the
  394. # user they originally asked for.
  395. #
  396.  
  397. blarf=$(who -w | grep ${termpath[$q]} | cut -b1-8 | cut -f1 -d' ')
  398. if [ $blarf != ${user[$q]} ]
  399. then
  400. echo "An error occured while checking the terminal."
  401. echo "You May be able to try again by typing  .users"
  402. echo "After you have entered chat."
  403. user[$q]="."
  404. termpath[$q]="null"
  405. fi
  406. fi
  407.  
  408. q=$(( 1+$q ))
  409. done
  410.  
  411. q=$(( 1 ))
  412. while [ $q != $maxterm ] 
  413. do
  414. echo "\n$LOGNAME is connected to you for an Ax-Talk\n" > /dev/${termpath[$q]}
  415. q=$(( 1+q ))
  416. done
  417.  
  418.  
  419. clear
  420. echo "Chat Connection Message sent.  To be courteous, please wait to"
  421. echo "receive chat connection message from other party, before trans-"
  422. echo "mitting anything."
  423. echo ""
  424. echo "Type .action to perform an action message."
  425. echo "Type .exec to run a single shell command without exiting Ax-Talk."
  426. echo "Type .quit to end Ax-Talk Session."
  427. echo "Type .clear to clear your screen during chat."
  428. echo "Type .users to modify which users the messages go to."
  429. echo "Type .adduser to temporarily add one more user to your Ax-Talk"
  430. echo "      session if all of your slots are filled."
  431. echo "Type .help to see this list of commands and other help messages."
  432. echo "Type .source to examine the script code for Ax-Talk."
  433. echo ""
  434.  
  435. while [ 1=1 ]   # Begins the main loop of the program
  436. do              #
  437.  
  438. read comand
  439. case $comand in
  440.  
  441. .adduser )      #Adds users to chat list.  See Revision Notes.
  442. clear
  443. maxtrm=$(( 1 + $maxtrm ))
  444. maxterm=$(( 1 + $maxterm ))
  445. q=$(( $maxtrm ))
  446. echo "Enter username of the user you wish to chat with, and hit <Enter>"
  447. echo "If the person you wish to talk with is logged on more than once,"
  448. echo "you will be asked what terminal you wish to talk with.  If you want"
  449. echo "to use the terminal path instead of the username, type a colon (:)"
  450. echo "followed by their terminal path (which is shown in the list below.)"
  451. echo "Examples:"
  452. echo ":pts/5"
  453. echo ":ttyp3"
  454. echo ":ttyS1"
  455. echo ":tty8"
  456. echo ""
  457. echo "Users Who Are Accepting Messages:"
  458. who -w | grep "+"
  459. echo ""
  460. read user[$q]
  461. termpath[$q]="$(who -w | grep "+" | grep ${user[$q]} | cut -b$termstart-$termend | cut -f1 -d' ')" 
  462. if [ $(echo ${user[$q]} | cut -b1) = ":" ]
  463. then
  464. termpath[$q]="$(echo ${user[$q]} | cut -b2-)"
  465. user[$q]="$(who -w | grep "+" | grep ${termpath[$q]} | cut -b-8 | cut -f1 -d' ')"
  466. fi
  467. uzer=${user[$q]}
  468.  
  469. if [ ${#uzer} = 1 ]
  470. then
  471. user[$q]="."
  472. termpath[$q]="null"
  473. fi
  474.  
  475. trmpath=${termpath[$q]}
  476. termlen=$(( ${#trmpath} ))
  477. #
  478. # Added in Ver 3.0.  Code to sense if a person is logged on more than once.
  479. #
  480.  
  481. if [ $termlen -gt $maxtermlen ]
  482. then
  483. echo "The user you have selected may be logged into the server"
  484. echo "more than once.  Please select a terminal from the following"
  485. echo "list.  Type the name of the terminal.  (I.E. pts/5   ttyp1  etc)."
  486. echo
  487. who -w | grep "+" | grep ${user[$q]}
  488. echo ""
  489. echo "Terminal Path:"
  490. read termpath[$q]
  491. #
  492. # Code to make sure that the terminal they chose is associated with the
  493. # user they originally asked for.
  494. #
  495.  
  496. blarf=$(who -w | grep ${termpath[$q]} | cut -b1-8 | cut -f1 -d' ')
  497. if [ $blarf != ${user[$q]} ]
  498. then
  499. echo "An error occured while checking the terminal."
  500. echo "You May be able to try again by typing  .users"
  501. echo "After you have entered chat."
  502. user[$q]="."
  503. termpath[$q]="null"
  504. fi
  505. fi
  506.  
  507. clear
  508. echo "Extra user (${user[$q]})was successfully added."
  509. echo "Back to chatting..." ;;
  510.  
  511. .source )    # View the source code and comments...woo!
  512. clear
  513. echo "This is the script source for Ax-Talk.  Hit <q> at any time to"
  514. echo "quit viewing the source.  Hit <SPACE> to scroll down."
  515. echo "Press <Enter> Now to start viewing source."
  516. read blarf
  517. cat ax-talk | more
  518. echo "Press <Enter> to continue chatting"
  519. read blarf ;;
  520.  
  521. .action )
  522. echo "-->The next line you type will show up as an action."
  523. read actioncmd
  524. echo "-->$LOGNAME $actioncmd"
  525. q=$(( 1 ))
  526. while [ $q != $maxterm ]
  527. do
  528. echo "$LOGNAME $actioncmd" > /dev/${termpath[$q]}
  529. q=$(( 1 + $q ))
  530. done 
  531. echo " " ;;
  532.  
  533.  
  534. .help )        # Show users the commands and general help stuff.
  535. echo ""
  536. echo "Type .action to perform an action message."
  537. echo "Type .exec to run a single shell command without quitting Ax-Talk."
  538. echo "Type .quit to end Ax-Talk Session."
  539. echo "Type .clear to clear your screen during chat."
  540. echo "Type .users to modify which users the messages go to."
  541. echo "Type .adduser to temporarily add another user to your Ax-Talk session"
  542. echo "      if all your slots are filled. "
  543. echo "Type .help to see this list of commands and other help messages."
  544. echo ""
  545. echo " .action     When you type .action, you are prompted for an"
  546. echo " action message.  This message is not much different than a normal"
  547. echo " message, other than the fact that it shows up to the users without"
  548. echo " the colon.  Example: if you typed 'is waving to everyone!' at the"
  549. echo " action message prompt, it would show up like this:"
  550. echo "     $LOGNAME is waving to everyone!" 
  551. echo " "
  552. echo " .exec       When you type .exec, you are prompted for a shell"
  553. echo " command.  Typical uses are for 'who', 'finger', and 'w', although"
  554. echo " this works for many other commands.  This is an advanced feature." ;;
  555.  
  556. .exec )        # Execute a command without quitting or suspending Ax-Talk
  557. echo "-->Enter a shell command to execute."
  558. read shellcommand
  559. $shellcommand
  560. echo "Back to chatting..." ;;
  561.  
  562. .clear )    # Clears your screen so no one can see that you're chatting.
  563. clear ;;
  564.  
  565. .users )    # View and edit what users are in your conference list.
  566. clear 
  567. who -w | grep "+"
  568. echo 
  569. echo "User Assignments"
  570. echo
  571. q=$(( 1 )) 
  572. while [ $q != $maxterm ]
  573. do
  574. echo "User $q: ${user[$q]}"
  575. q=$(( 1 + $q ))
  576. done
  577. echo
  578. echo "Edit which user? 1 - $maxtrm, RETURN for no change."
  579. read q 
  580. while [ $q != "3210" ] 
  581. do
  582. echo "Enter username for User $q.  If you are cutting User$q out of the conference,"
  583. echo "place a period '.'  Optionaly, you can place a colon ':' followed by"
  584. echo "their terminal path.  You must use this method if they are logged on"
  585. echo "more than once."
  586. read user[$q]
  587. termpath[$q]="$(who -w | grep "+" |  grep ${user[$q]} | cut -b$termstart-$termend | cut -f1 -d' ')" 
  588. if [ $(echo ${user[$q]}| cut -b1) = ":" ]
  589. then
  590. termpath[$q]="$(echo ${user[$q]} | cut -b2-)"
  591. user[$q]="$(who -w | grep "+" | grep ${termpath[$q]} | cut -b-8 | cut -f1 -d' ')"
  592. fi
  593. uzer=${user[$q]}
  594. if [ ${#uzer} = 1 ]
  595. then
  596. termpath[$q]="null"
  597. fi 
  598. echo "user $q changed."
  599. q=$(( 3210 ))
  600. done 
  601. clear
  602. echo "Back to chatting..." ;;
  603.  
  604.  
  605. .quit)        # Quits Ax-Talk
  606. break ;;
  607. *)        # Communicates with other Ax-Talks, and sends your chat 
  608.         # message out.
  609. q=$(( 1 ))
  610. while [ $q != $maxterm ]
  611. do
  612. uzer=${user[$q]}
  613. if [ ${#uzer} != 1 ]
  614. then
  615. if [ $(cat ~${user[$q]}/.ax-talk-status | cut -f1 -d' ') = "0" ]
  616. then
  617. user[$q]="."
  618. termpath[$q]="null"
  619. fi
  620. fi
  621. q=$(( 1+$q ))
  622. done
  623.  
  624.  
  625. q=$(( 1 ))
  626. while [ $q != $maxterm ]
  627. do
  628. echo "\n$LOGNAME: $comand" > /dev/${termpath[$q]}
  629. q=$(( 1+$q ))
  630. done ;;
  631.  
  632.  
  633. esac
  634. done        # End of main program loop.
  635.  
  636.  
  637. echo "0" > ~/.ax-talk-status    # Tells other Ax-Talks that you've quit.
  638. q=$(( 1 ))
  639. while [ $q != $maxterm ]    # Oh, yah.  The actual people might
  640. do                # want to know you quit, too...
  641. echo "\n$LOGNAME: has closed Ax-Talk." > /dev/${termpath[$q]}
  642. q=$(( 1+$q ))
  643. done
  644. echo "Closing Ax-Talk."                                                                                    
  645.  
  646. <-------------------------CUT HERE(END)------------------------------>
  647.  
  648.